package com.jsmile.cloud.authc.sys.model;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import com.jsmile.cloud.authc.api.req.sys.ReqSysDeptUpdate;

import cn.hutool.core.bean.BeanUtil;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

/**
 * @author 龚亮
 * @version 1.0
 * @desc 为了薪资破万，还是睡一会儿吧...!
 * @date 2019年11月01日 08:52:39
 */
@ApiModel
@Data
@TableName("t_op_sys_department")
public class SysDepartment extends Model<SysDepartment> {

    private static final long serialVersionUID = 1L;

    @ApiModelProperty(value = "id")
    @TableId(value = "id", type = IdType.AUTO)
    private Long id;
    @ApiModelProperty(value = "部门名称")
    private String deptName;
    @ApiModelProperty(value = "部门地址")
    private String deptAddress;
    @ApiModelProperty(value = "部门电话")
    private String deptPhone;
    @ApiModelProperty(value = "类型 1公司  2公司领导 3部门  4团队或组织")
    private Integer deptType;
    @ApiModelProperty(value = "上级部门")
    private Long parentId;
    @ApiModelProperty(value = "备注")
    private String remark;
    @ApiModelProperty(value = "创建时间")
    private java.util.Date createTime;
    @ApiModelProperty(value = "更新时间")
    private java.util.Date updateTime;
    @ApiModelProperty(value = "租户id")
    private Long tenantId;
    @ApiModelProperty(value = "create_by")
    private String createBy;
    @ApiModelProperty(value = "update_by")
    private String updateBy;
    @TableLogic
    @ApiModelProperty(value = "是否删除")
    private Integer delFlag;

    public static SysDepartment create(ReqSysDeptUpdate reqSysDeptUpdate) {
        SysDepartment sysDepartment = BeanUtil.toBean(reqSysDeptUpdate, SysDepartment.class);
        return sysDepartment;
    }
}
